using namespace std;
#include<string>
#include<iostream>

int main()
{
    string s;
    cin >> s;
    string rs;
    for(auto ch : s)
    {
        if(rs.empty() || ch != rs.back())
            rs += ch;
        else
            rs.pop_back();
    }
    if(!rs.empty())
        cout << rs << endl;
    else
        cout << 0 << endl;
    return 0;
}